package com.JJL.controller;

import com.JJL.util.SSOUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class MainController {

    @RequestMapping("/demo1/main")
    public String gotoOne(HttpServletRequest request){
        if(SSOUtil.checkCookie(request)){
            return "demo1";
        }
        request.setAttribute("gotoUrl","/demo1/main");
        return "login";
    }

    @RequestMapping("/demo2/main")
    public String gotoTwo(HttpServletRequest request){
        if(SSOUtil.checkCookie(request)){
            return "demo2";
        }
        request.setAttribute("gotoUrl","/demo2/main");
        return "login";
    }

}
